#ifndef CH395_H
#define CH395_H
#include "example.h"
#include "CH395CMD.h"


#define  BUFF_LENGTH   2048

typedef struct 
{
  uint8_t  data[BUFF_LENGTH];
  uint8_t  rcvflag;
  uint16_t length;
}RECV_BUFF,*pRECV_BUFF;

extern uint8_t    s1_send_buffer_free;
extern uint8_t    s1_tcp_connected;
extern RECV_BUFF  s1_rcv_buffer;
extern RECV_BUFF  s0_rcv_buffer;

uint8_t    CH395_if_config(pifconfig config);                       /*CH395 初始化 */
void       CH395_socket_init(uint8_t sn, pifconfig config);         /*socket 初始化*/
uint8_t    CH395_socket_open(uint8_t sn);                           /*socket 打开  */
uint8_t    CH395_socket_close(uint8_t sn);                          /*socket 关闭  */
uint8_t    CH395_tcp_connect(uint8_t sn);                           /*tcp 建连     */
uint16_t   CH395_GlobalInterrupt(void);
bool       CH395_send_sn(uint8_t sn, uint16_t len, uint8_t* pbuf);  /*tcp 发送数据 */
#endif